﻿using HRMSystemShi.Model;

using Microsoft.Data.SqlClient;

namespace HRMSystemShi.DAL
{
    public class DictionaryService
    {
        public static List<Dictionary> GetDictionaryList(Category category)
        {
            List<Dictionary> dictionarys = new List<Dictionary>();
            string sql = "SELECT * FROM Dictionary Where Category=@category";
            SqlDataReader reader = SqlHelper.ExecuteReader(sql, new SqlParameter("@category", category.ToString()));
            while (reader.Read())
            {
                Dictionary dictionary = new Dictionary { Id = (Guid)reader["Id"], Name = reader["Name"].ToString(), Category = category };
                dictionarys.Add(dictionary);
            }
            return dictionarys;
        }
    }
}
